package com.perceptivesoftware.licensing.client.common;

import com.extjs.gxt.ui.client.Style.ButtonArrowAlign;
import com.extjs.gxt.ui.client.Style.ButtonScale;
import com.extjs.gxt.ui.client.Style.IconAlign;
import com.extjs.gxt.ui.client.core.Template;
import com.extjs.gxt.ui.client.util.IconHelper;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.google.gwt.user.client.ui.AbstractImagePrototype;

/**
 * Logo branding Button; holds the auspicious upper left corner position. Its
 * also a menu!
 *
 * <p/>
 * Copyright 2012 Perceptive Software
 * <p/>
 * Project: Perceptive Licensing
 * <p/>
 * Confidential and Proprietary
 *
 * @author Nolan Brassard
 *
 */
public class PerceptiveLogoSplitButton extends Button
{
	public PerceptiveLogoSplitButton()
	{
		super();

		final StringBuffer sb = new StringBuffer();
		sb.append("<table cellspacing=\"0\" class=\"x-btn\" role=\"presentation\"><tbody class=\"{2}\" >");
		sb.append("<tr><td class=\"x-btn-tl\"><i>&#160;</i></td><td class=\"x-btn-tc\"></td><td class=\"x-btn-tr\"><i>&#160;</i></td></tr>");
		sb.append("<tr><td class=\"x-btn-ml\"><i>&#160;</i></td><td class=\"x-btn-mc\"><em class=\"{3}\" unselectable=\"on\"><button class=\"perceptive-logo-button\" type=\"{1}\" style='position: static;width:85px'>{0}</button></em></td><td class=\"x-btn-mr\"><i>&#160;</i></td></tr>");
		sb.append("<tr><td class=\"x-btn-bl\"><i>&#160;</i></td><td class=\"x-btn-bc\"></td><td class=\"x-btn-br\"><i>&#160;</i></td></tr>");
		sb.append("</tbody></table>");

		template = new Template(sb.toString());

		setWidth(100);
		final AbstractImagePrototype button = IconHelper.createStyle("perceptive-logo-small", 85, 15);
		setIconAlign(IconAlign.LEFT);
		setArrowAlign(ButtonArrowAlign.RIGHT);
		setIcon(button);
		setScale(ButtonScale.SMALL);
		setHeight(20);
	}

}
